import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DemoComponent } from './components/demo/demo.component';
import { NotFoundComponent } from './components/not-found/not-found.component';
import { authGuard } from './auths/auth.guard';
import { Auth2Guard } from './auths/auth2.guard';

const routes: Routes = [
  {
    path: 'demo',
    component: DemoComponent,
    data: { auth: false },
    canActivate: [Auth2Guard]
  },
  {
    path: '',
    pathMatch: 'full',
    redirectTo: '/demo',
  },
  {
    path: 'lazy-child',
    loadChildren: () =>
      import('./lazy-child/lazy-child.module').then((m) => m.LazyChildModule),
  },
  {
    path: '**',
    component: NotFoundComponent,
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}
